package com.sgb.kjwl.view.ui.adapter.device;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ItemDeviceList3Binding;
import com.sgb.kjwl.model.entity.lease.DeviceListEntity3;
import com.sgb.kjwl.model.entity.lease.MachineListEntity3;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class DeviceListAdapter3 extends BaseRecycleAdapter<DeviceListEntity3> {

    ItemDeviceList3Binding binding;

    public DeviceListAdapter3(Context context, List<DeviceListEntity3> datas) {
        super(context, R.layout.item_device_list3, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final DeviceListEntity3 entity) {
        holder.setBinding(BR.viewModel, entity);
        binding = (ItemDeviceList3Binding) holder.getmBinding();
        binding.tvIsSelf.setVisibility("1".equals(entity.getIsSelf()) ? View.VISIBLE : View.INVISIBLE);
        binding.tvArea.setText(entity.getCityName() + " " + entity.getDistrictName());
        if ("1".equals(entity.getNegotiable())) {
            binding.priceView.setText("面议");
        } else {
            binding.priceView.setText(entity.getPrice() + entity.getUnitName());
        }
        try {
            binding.tvTime.setText(entity.getTime());
        } catch (Exception e) {

        }
    }
}